home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / indexing / IXAttributeParser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-06  |  3.4 KB  |  98 lines

  1. /*
  2. IXAttributeParser.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    <objc/Object.h>
  7. #import    <objc/hashtable.h>
  8.  
  9. #import    "protocols.h"
  10.  
  11. @class List, IXAttributeBinder, IXFileConverter, IXWeightingDomain;
  12.  
  13. // These atoms define standard attributes generated by the attribute parser.
  14.  
  15. extern NXAtom    IXDefaultAttribute;
  16. extern NXAtom    IXContentAttribute;
  17.  
  18. // These atoms define pasteboard types used by the attribute parser.  The 
  19. // former is the for the tokenized format produced by attribute readers.  The 
  20. // latter is for file descriptions generated by pasteboard file filters.
  21.  
  22. extern NXAtom    IXAttributeReaderPboardType;
  23. extern NXAtom    IXFileDescriptionPboardType;
  24.  
  25. // These are the types of weighting applied to tokens by the attribute parser.  
  26. // Absolute weighting produces weights representing the number of occurrences 
  27. // of the token.  Frequency weighting produces weights representing the count 
  28. // divided by the total number of tokens in the sample.  Peculiarity weighting 
  29. // produces weights representing the frequency relative to a weighting domain.
  30.  
  31. typedef enum {
  32.     IX_NoWeighting = 0, 
  33.     IX_AbsoluteWeighting, IX_FrequencyWeighting, IX_PeculiarityWeighting 
  34. } IXWeightingType;
  35.  
  36. @interface IXAttributeParser: Object <IXAttributeBinding>
  37. {
  38.     BOOL        _tokenUniquing;
  39.     NXHashTable        *_sourceTypes;
  40.     id            _attributeBinder;
  41.     id            _fileConverter;
  42.     List        *_attributeMapping;
  43.     List        *_attributeReaders;
  44.     IXWeightingType    _weightingType;
  45.     IXWeightingDomain    *_weightingDomain;
  46.     unsigned        _minimumWeight;
  47.     unsigned        _percentPassed;
  48. }
  49.  
  50. // These methods manage the list of attribute readers.  The source stream is 
  51. // pipelined through the list of readers in the order in which they appear.
  52.  
  53. - getAttributeReaders:(List *)aList; // fills the list with installed readers.
  54. - setAttributeReaders:(List *)aList; // sets the readers from the supplied list.
  55.  
  56. - (BOOL)understandsType:(const char *)type; // always yes until types are added
  57. - addSourceType:(const char *)type; // adds to the set of understood types
  58. - removeSourceType:(const char *)type; // removes a previously understood type
  59.  
  60. @end
  61.  
  62. @interface IXAttributeParser(Parsing)
  63.  
  64. - reset; // clears the accumulated attribute bindings
  65.  
  66. // if type is NULL or empty, this method will type the file
  67. - parseFile:(const char *)filename ofType:(const char *)type;
  68. - parseStream:(NXStream *)stream ofType:(const char *)type;
  69.  
  70. // These methods pass the source through the list of attribute parsers, 
  71. // producing attribute reader format, rather than attribute bindings.
  72.  
  73. // if type is NULL or empty, this method will type the file
  74. - (NXStream *)analyzeFile:(const char *)filename ofType:(const char *)type;
  75. - (NXStream *)analyzeStream:(NXStream *)stream ofType:(const char *)type;
  76.  
  77. @end
  78.  
  79. @interface IXAttributeParser(Configuration)
  80.  
  81. - (unsigned)minimumWeight; // returns minimum weight
  82. - setMinimumWeight:(unsigned)aMinimum; // sets minimum weight
  83.  
  84. - (unsigned)percentPassed; // returns per centage passed
  85. - setPercentPassed:(unsigned)aPercent; // sets per centage passed
  86.  
  87. - (IXWeightingDomain *)weightingDomain; // returns weighting domain
  88. - setWeightingDomain:(IXWeightingDomain *)aDomain; // sets weighting domain
  89.  
  90. - (IXWeightingType)weightingType; // returns weighting type 
  91. - setWeightingType:(IXWeightingType)type; // sets weighting type
  92.  
  93. - (IXFileConverter *)fileConverter; // returns file converter
  94. - setFileConverter:(IXFileConverter *)aConverter; // sets file converter
  95.  
  96. @end
  97.  
  98.